9490cf
@@ -36,6 +36,7 @@
import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.net.ssl.SSLContext;
 import javax.security.auth.callback.CallbackHandler;
+import javax.security.sasl.SaslException;
 
 import org.jboss.as.cli.CommandLineException;
 import org.jboss.as.cli.ControllerAddress;
@@ -258,6 +259,10 @@
public class CLIModelControllerClient extends AbstractModelControllerClient {
             }
 
             if (ioe != null) {
+                if (ioe.getCause() != null && ioe.getCause() instanceof SaslException) {
+                    throw new CommandLineException("Failed to establish connection", ioe);
+                }
+
                 if (System.currentTimeMillis() - start > timeoutMillis) {
                     throw new CommandLineException("Failed to establish connection in " + (System.currentTimeMillis() - start)
                             + "ms", ioe);
